import { defineStore } from "pinia";
import { zhCN, dateZhCN, enUS, dateEnUS } from "naive-ui";
import { LANG_VALUE } from "@/dict/lang.js";

const appGlobalStore = defineStore('appGlobal', {
  state: () => {
    return {
      contentFullScreen: false, // 内容是否可全屏展示
      showLogo: true, // 是否显示Logo
      language: '',
      theme: {
        state: {
          style: "default",
          primaryColor: "#409eff",
          menuType: "side",
        },
      },
      menuList: [],
    };
  },
  getters: {
    locale() {
      switch (this.language) {
        case LANG_VALUE.En:
          return enUS
        case LANG_VALUE.Zh:
          return zhCN
        default:
          break
      }
    },
    dateLocale() {
      switch (this.language) {
        case LANG_VALUE.En:
          return dateEnUS;
        case LANG_VALUE.Zh:
          return dateZhCN;
        default:
          break;
      }
    },
    getContentFullScreen(){
      return this.contentFullScreen
    }
  },
  actions: {
    contentFullScreenChange(type) {
      this.contentFullScreen = type
    },
    menuListChange(arr) {
      this.menuList = arr
    },
    stateChange(option) {
      this[option.name] = option.value
    }
  }
})


export default appGlobalStore;